package com.own.business.system.user.entity.bo;

import com.own.business.system.user.entity.po.SystemUserInfo;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * SystemUserInfoBo
 *
 * @author chenxueli
 * @date 2021/06/24 15:46:54
 */
@Schema(title = "系统用户基本信息" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SystemUserInfoBo extends BaseBo<SystemUserInfo> {

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 名称
     */
    private String name;

    /**
     * 手机号
     */
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 性别 1=男 2=女 0=保密
     */
    private Integer gender;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 介绍
     */
    private String introduction;

    /**
     * 用户类型 1=普通用户 2=管理员
     */
    private Integer type;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public SystemUserInfo toPo(SystemUserInfo entity) {
        if (entity == null) {
            entity = new SystemUserInfo();
        }
        entity.setFkUserId(userId);
        entity.setName(name);
        entity.setPhone(phone);
        entity.setEmail(email);
        entity.setGender(gender);
        entity.setAvatar(avatar);
        entity.setIntroduction(introduction);
        entity.setType(type);
        return super.toPo(entity);
    }

}
